# Replication archive for: Coppock, Alexander and Seth J. Hill and Lynn Vavreck. 2020. "The Small Effects of Political Advertising are Small Regardless of Context, Message, Sender, or Receiver: Evidence from 59 Real-time Randomized Experiments" Science Advances, forthcoming.

# design table ------------------------------------------------------------
library(tidyverse)
library(janitor)
library(xtable)

exps <- read_rds("exps.rds")

exps <- 
  exps %>%
  mutate(
    date_formated = format(date, format = "%B %d"),
    date_formated = fct_reorder(factor(date_formated), date)
  )

# Create ads table and export ---------------------------------------------

exps %>%
  filter(!assignment %in% c("Control", "Two Ads")) %>%
  group_by(date_formated, ad_title, assignment) %>%
  summarize() %>% 
  group_by(date_formated) %>%
  mutate(ad_num = paste0("Ad ", 1:n())) %>%
  ungroup %>%
  transmute(date_formated, ad_num, entry = paste0(assignment, ": ``", ad_title, "''")) %>%
  spread(ad_num, entry) %>%
  xtable %>%
  print.xtable(
    include.rownames = FALSE,
    include.colnames = FALSE,
    only.contents = TRUE,
    hline.after = c()
  )






